<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function http({method,url}) {
            return new Promise((resolve, reject) => {
                var xhr =new XMLHttpRequest();
                xhr.open(method,url,true);
                xhr.send();
                xhr.onreadystatechange = function(){
                    if(xhr.readyState ==4){
                        if(xhr.status==200){
                            var res = JSON.parse(xhr.responseText);
                            resolve(res);
                        }else{
                            reject(res);
                        }
                    } 
                }
            })
        }
        http({
            method:"get",
            url:"http://192.168.4.18:3000/top/playlist/?cat=华语"
        }).then(
            (res)=>{console.log(res);},
            (res)=>{console.log(res);}
        )
    </script>
</body>

</html>